home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 February: Tool Chest / Dev.CD Feb 95 / Dev.CD Feb 95.toast / Tool Chest / Interfaces / Universal Interfaces 2.0a3 / Universal AIncludes / WorldScript.a < prev   
Encoding:
Text File  |  1994-11-11  |  8.1 KB  |  331 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        WorldScript.a
  3. ;
  4. ;    Copyright:    © 1984-1994 by Apple Computer, Inc.
  5. ;                All rights reserved.
  6. ;
  7. ;    Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8. ;
  9. ;    Bugs?:        If you find a problem with this file, send the file and version
  10. ;                information (from above) and the problem description to:
  11. ;
  12. ;                    Internet:    apple.bugs@applelink.apple.com
  13. ;                    AppleLink:    APPLE.BUGS
  14. ;
  15. ;
  16.  
  17.     IF &TYPE('__WORLDSCRIPT__') = 'UNDEFINED' THEN
  18. __WORLDSCRIPT__ SET 1
  19.  
  20.  
  21.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  22.     include 'Types.a'
  23.     ENDIF
  24. ;        include 'ConditionalMacros.a'                                ;
  25.  
  26.     IF &TYPE('__TRAPS__') = 'UNDEFINED' THEN
  27.     include 'Traps.a'
  28.     ENDIF
  29.  
  30.     IF &TYPE('__QUICKDRAWTEXT__') = 'UNDEFINED' THEN
  31.     include 'QuickdrawText.a'
  32.     ENDIF
  33. ;        include 'MixedMode.a'                                        ;
  34.  
  35. kVariableLengthArray            EQU        1
  36.  
  37. ; offset from start of sub-table to row in state table 
  38. kScriptSettingsTag                EQU        'info'
  39. kMetamorphosisTag                EQU        'mort'
  40. kGlyphExpansionTag                EQU        'g2g#'
  41. kPropertiesTag                    EQU        'prop'
  42. kJustificationTag                EQU        'kash'
  43. kCharToGlyphTag                    EQU        'cmap'
  44. kGlyphToCharTag                    EQU        'pamc'
  45. kFindScriptRunTag                EQU        'fstb'
  46.  
  47. ;***             L O O K U P    T A B L E    T Y P E S        ***
  48. WSILookupSimpleArray            EQU        0                    ; a simple array indexed by glyph code 
  49. WSILookupSegmentSingle            EQU        2                    ; segment mapping to single value 
  50. WSILookupSegmentArray            EQU        4                    ; segment mapping to lookup array 
  51. WSILookupSingleTable            EQU        6                    ; sorted list of glyph, value pairs 
  52. WSILookupTrimmedArray            EQU        8                    ; a simple trimmed array indexed by glyph code 
  53.  
  54. ; An offset from the beginning of the lookup table 
  55. ;    FORMAT SPECIFIC DEFINITIONS 
  56. ;
  57. ;        lookupSimpleArray:
  58. ;        
  59. ;        This is a simple array which maps all glyphs in the font
  60. ;        to lookup values.
  61. ;    
  62. WSILookupArrayHeader     RECORD    0
  63. lookupValues             ds.w    1                                    ; The array of values indexed by glyph code 
  64. sizeof                     EQU    2
  65.                         ENDR
  66.  
  67. ;
  68. ;        lookupTrimmedArray:
  69. ;        
  70. ;        This is a single trimmed array which maps a single range
  71. ;        of glyhs in the font to lookup values.
  72. ;    
  73. WSILookupTrimmedArrayHeader RECORD    0
  74. firstGlyph                 ds.w    1
  75. limitGlyph                 ds.w    1
  76. valueArray                 ds.w    1
  77. sizeof                     EQU    6
  78.                         ENDR
  79.  
  80. ; The format specific part of the subtable header 
  81. WSILookupFormatSpecificHeader RECORD    0
  82. VariantLevel0Begin        EQU    *
  83. lookupArray                 ds        WSILookupArrayHeader
  84.                         ORG        VariantLevel0Begin
  85. trimmedArray             ds        WSILookupTrimmedArrayHeader
  86. sizeof                     EQU    6
  87.                         ENDR
  88.  
  89. ; The overall subtable header 
  90. WSILookupTableHeader     RECORD    0
  91. format                     ds.w    1                                    ; table format 
  92. fsHeader                 ds.w    3                                    ; format specific header 
  93. sizeof                     EQU    8
  94.                         ENDR
  95.  
  96. ;***        G L Y P H    E X P A N S I O N    ***
  97.  
  98. ; fixed 1.0 
  99. kCurrentGlyphExpansionVersion    EQU        $00010000
  100.  
  101. GlyphExpansionLookupFormat        EQU        1
  102. GlyphExpansionContextualFormat    EQU        2
  103.  
  104. ExpandedGlyphCluster     RECORD    0
  105. numGlyphs                 ds.b    1
  106. bestGlyph                 ds.b    1
  107. glyphs                     ds.w    1
  108. sizeof                     EQU    4
  109.                         ENDR
  110.  
  111. ExpandedGlyphOffset     RECORD    0
  112. glyph                     ds.w    1
  113. offset                     ds.w    1                                    ; offset to ExpandedGlyphCluster 
  114. sizeof                     EQU    4
  115.                         ENDR
  116.  
  117. GlyphExpansionStateTable RECORD    0
  118. stateTableOffset         ds.w    1
  119. classTableOffset         ds.w    1
  120. actionTableOffset         ds.w    1                                    ; state, class and actions tables follow here... 
  121. sizeof                     EQU    6
  122.                         ENDR
  123.  
  124. GlyphExpansionTable     RECORD    0
  125. version                     ds.l    1
  126. format                     ds.w    1
  127. expansionNumer             ds.w    1
  128. expansionDenom             ds.w    1                                    ; num/denom ratio for expansion <2> 
  129. VariantLevel0Begin        EQU    *
  130. stateTable                 ds        GlyphExpansionStateTable
  131.                         ORG        VariantLevel0Begin
  132. lookup                     ds        WSILookupTableHeader                ; expanded glyph clusters follow here... 
  133. sizeof                     EQU    18
  134.                         ENDR
  135.  
  136. ; Glyph-to-Character constants and types  
  137.  
  138. kCurrentGlyphToCharVersion        EQU        $00010100
  139.  
  140. kGlyphToCharLookup8Format        EQU        1
  141. kGlyphToCharLookup16Format        EQU        2
  142. kGlyphToCharLookup32Format        EQU        3
  143.  
  144. GlyphToCharActionTable     RECORD    0
  145. fontNameOffset             ds.w    1                                    ; offset relative to this table 
  146. actions                     ds        WSILookupTableHeader                ; only support lookupSimpleArray format for now 
  147. sizeof                     EQU    10
  148.                         ENDR
  149.  
  150. GlyphToCharActionHeader RECORD    0
  151. numTables                 ds.w    1                                    ; 0..n 
  152. offsets                     ds.w    1                                    ; offsets from start of action table header 
  153. sizeof                     EQU    4
  154.                         ENDR
  155.  
  156. GlyphToCharHeader         RECORD    0
  157. version                     ds.l    1
  158. actionOffset             ds.w    1                                    ; offset to GlyphToCharActionHeader 
  159. format                     ds.w    1                                    ; size of font mask 
  160. mappingTable             ds        WSILookupTableHeader
  161. sizeof                     EQU    16
  162.                         ENDR
  163.  
  164. ; JUSTIFICATION TYPES
  165. ;    WorldScript supports justification of text using insertion. The justification
  166. ;    table specifies a insertion string to insert between 2 specified glyphs.
  167. ;    Each combination of inter-glyph boundary can be assigned a justification priority,
  168. ;    the higher the priority the more justification strings inserted at that position.
  169. ;    
  170. ;    The priorities for each inter-glyph boundary are specified by the justification table's
  171. ;    state table.
  172. ;    
  173. ;    Special handling is done for scripts which use spaces to justify, because the width of 
  174. ;    a space varies depending on the setting of SpaceExtra. This is why the number of spaces
  175. ;    per inserting string is specified in the justification table.
  176. ;
  177. ;
  178.  
  179. ; 1.0 not supported 
  180. kCurrentJustificationVersion    EQU        $0200
  181.  
  182. kJustificationStateTableFormat    EQU        1
  183.  
  184. ; WSI's internal limitation <12> 
  185. kMaxJustificationStringLength    EQU        13
  186.  
  187. WSIJustificationSetMarkMask        EQU        $80
  188.  
  189. WSIJustificationStateEntry RECORD    0
  190. markPriority             ds.b    1                                    ; non-zero priorities means insertion 
  191. priority                 ds.b    1
  192. newState                 ds.w    1
  193. sizeof                     EQU    4
  194.                         ENDR
  195.  
  196.  
  197. wsiJustEndOfLineClass            EQU        0
  198. wsiJustEndOfRunClass            EQU        1
  199. wsiJustDeletedGlyphClass        EQU        2
  200. wsiJustUserDefinedClass            EQU        3
  201.  
  202. wsiStartOfLineState                EQU        0                    ; pre-defined states 
  203. wsiStartOfRunState                EQU        1
  204. wsiUserDefinedState                EQU        2
  205.  
  206. ; pre-multiplied: class# * sizeof(WSIJustificationStateEntry) 
  207. WSIJustificationStateTable RECORD    0
  208. maxPriorities             ds.w    1
  209. rowWidth                 ds.w    1                                    ; width of a state table row in bytes 
  210. classTableOffset         ds.w    1
  211. stateTableOffset         ds.w    1
  212. sizeof                     EQU    8
  213.                         ENDR
  214.  
  215. WSIJustificationHeader     RECORD    0
  216. version                     ds.w    1
  217. format                     ds.w    1
  218. scaling                     ds        Point                                ; numer/denom scaling of priority weights <7> 
  219. spacesPerInsertion         ds.w    1                                    ; # of $20 chars in justification insertion string <12> 
  220. justStringOffset         ds.w    1                                    ; offset to justification string 
  221. stateTable                 ds        WSIJustificationStateTable            ; long-aligned boundary aligned w/ spacesPerInsertion field - justification string follows 
  222. sizeof                     EQU    20
  223.                         ENDR
  224.  
  225. ; Line Layout's Property table version <11> 
  226.  
  227. ; v1.0 
  228. currentPropsTableVersion        EQU        $00010000
  229.  
  230. ; ??? is this right 
  231. kCharToGlyphCurrentVersion        EQU        0100
  232.  
  233. ; pass as priorityWeight to JustifyWSILayout to use script's current just setting 
  234. kScriptsDefaultJustWeight        EQU        -1
  235.  
  236. WSIGlyphInfoRec         RECORD    0
  237. qdChar                     ds.b    1
  238. rightToLeft                 ds.b    1                                    ; !0 means rightToLeft, 0 means leftToRight 
  239. fontID                     ds.w    1
  240. originalOffset             ds.w    1                                    ; or negative original offset if not in original text input 
  241. unused                     ds.w    1                                    ; long-align 
  242. sizeof                     EQU    8
  243.                         ENDR
  244.  
  245.     IF GENERATING68K THEN
  246.         Macro
  247.         _NewWSILayout
  248.             dc.w     $2F3C
  249.             dc.w     $8414
  250.             dc.w     $0040
  251.             dc.w     $A8B5
  252.         EndM
  253.     ELSE
  254.         IMPORT    NewWSILayout
  255.     ENDIF
  256.  
  257.     IF GENERATING68K THEN
  258.         Macro
  259.         _JustifyWSILayout
  260.             dc.w     $2F3C
  261.             dc.w     $8418
  262.             dc.w     $0042
  263.             dc.w     $A8B5
  264.         EndM
  265.     ELSE
  266.         IMPORT    JustifyWSILayout
  267.     ENDIF
  268.  
  269.     IF GENERATING68K THEN
  270.         Macro
  271.         _MeasureWSILayout
  272.             dc.w     $2F3C
  273.             dc.w     $840C
  274.             dc.w     $0044
  275.             dc.w     $A8B5
  276.         EndM
  277.     ELSE
  278.         IMPORT    MeasureWSILayout
  279.     ENDIF
  280.  
  281.     IF GENERATING68K THEN
  282.         Macro
  283.         _DrawWSILayout
  284.             dc.w     $2F3C
  285.             dc.w     $800C
  286.             dc.w     $0046
  287.             dc.w     $A8B5
  288.         EndM
  289.     ELSE
  290.         IMPORT    DrawWSILayout
  291.     ENDIF
  292.  
  293. ; "low-level" routines 
  294.     IF GENERATING68K THEN
  295.         Macro
  296.         _GetWSILayoutParts
  297.             dc.w     $2F3C
  298.             dc.w     $8410
  299.             dc.w     $0048
  300.             dc.w     $A8B5
  301.         EndM
  302.     ELSE
  303.         IMPORT    GetWSILayoutParts
  304.     ENDIF
  305.  
  306.     IF GENERATING68K THEN
  307.         Macro
  308.         _DrawWSIGlyphs
  309.             dc.w     $2F3C
  310.             dc.w     $800E
  311.             dc.w     $004A
  312.             dc.w     $A8B5
  313.         EndM
  314.     ELSE
  315.         IMPORT    DrawWSIGlyphs
  316.     ENDIF
  317.  
  318.     IF GENERATING68K THEN
  319.         Macro
  320.         _xMeasureWSIGlyphs
  321.             dc.w     $2F3C
  322.             dc.w     $840E
  323.             dc.w     $004C
  324.             dc.w     $A8B5
  325.         EndM
  326.     ELSE
  327.         IMPORT    xMeasureWSIGlyphs
  328.     ENDIF
  329.  
  330.     ENDIF ; __WORLDSCRIPT__
  331.